<template>
  <el-container>
    <el-header height="80px">
      <div class="headerBox">
        <div class="imgBox"></div>
        <span class="title">学生成绩管理系统</span>
        <el-button type="primary" class="exit" @click="editBtn">退出</el-button>
      </div>
    </el-header>
    <el-container>
      <el-aside width="230px">
        <el-menu
          :default-active="$route.path"
          style="height: 100%"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
          @select="selectItem"
        >
          <el-submenu index="1">
            <template #title>
              <i class="el-icon-s-home"></i>
              <span>系统首页</span>
            </template>
            <el-menu-item index="/home/order">我的</el-menu-item>
          </el-submenu>
          <el-submenu index="2">
            <template #title>
              <i class="el-icon-reading"></i>
              <span>成绩查询</span>
            </template>
            <el-menu-item index="/home/goods/0">成绩查询首页</el-menu-item>
            <el-menu-item index="/home/goods/1">第一</el-menu-item>
            <el-menu-item index="/home/goods/2">第二</el-menu-item>
            <el-menu-item index="/home/category">第三</el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template #title>
              <i class="el-icon-s-custom"></i>
              <span>学生管理</span>
            </template>
            <el-menu-item index="/home/ownerlist">学生管理首页</el-menu-item>
            <el-menu-item index="/home/ownerreq">第一</el-menu-item>
            <el-menu-item index="/home/ownerorder">第二</el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template #title>
              <i class="el-icon-document"></i>
              <span>成绩管理</span>
            </template>
            <el-menu-item index="/home/tradeinfo">成绩管理首页</el-menu-item>
            <el-menu-item index="/home/tradelist">第一</el-menu-item>
          </el-submenu>
          <el-submenu index="5">
            <template #title>
              <i class="el-icon-data-line"></i>
              <span>科目管理</span>
            </template>
            <el-menu-item index="/home/data">数据统计</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <!-- 这里用来渲染具体的功能模块 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {
    logout() {
      Storage.commit('clearUserInfo')
      this.$router.push({ name: 'login' })
    },
    selectItem(index) {
      this.$router.push(index)
    },
    editBtn() {
      this.$router.push({ path: '../login' })
    },
  },
}
</script>

<style lang="less">
html,
body {
  width: 100%;
  height: 100%;
}

.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 73px;
}

.el-aside {
  background-color: #d3dce6;
  background-color: rgb(84, 92, 100);
  text-align: center;
  height: 893px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

.headerBox {
  height: 80px;
  width: 100%;
  position: relative;
  .imgBox {
    position: absolute;
    left: -20px;
    width: 230px;
    height: 80px;
    background: url('@/assets/images/logo.png') no-repeat;
    background-size: 100% 100%;
  }
  .title {
    font-size: 30px;
    font-weight: 700;
    position: absolute;
    left: 850px;
  }
  .exit {
    position: absolute;
    right: 20px;
    width: 100px;
    height: 50px;
    top: 15px;
  }
  .el-button--primary {
    color: #fff;
    font-size: 21px;
    background-color: #409eff;
    border-color: #409eff;
  }
}
</style>
